home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / Source / MSG Demo 1.4.source Folder / Demo ƒ / Wipes reversed ƒ / Quadrant wipe 2 reversed.c < prev    next >
Text File  |  1994-04-15  |  3KB  |  107 lines

  1. /**********************************************************************\
  2.  
  3. File:        Quadrant wipe 2 reversed.c
  4.  
  5. Purpose:    Graphic effect from offscreen bitmap to main window (on
  6.             screen).  See comments below for more description.
  7.  
  8. This program is free software; you can redistribute it and/or modify
  9. it under the terms of the GNU General Public License as published by
  10. the Free Software Foundation; either version 2 of the License, or
  11. (at your option) any later version.
  12.  
  13. This program is distributed in the hope that it will be useful,
  14. but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. GNU General Public License for more details.
  17.  
  18. You should have received a copy of the GNU General Public License
  19. along with this program in a file named "GNU General Public License".
  20. If not, write to the Free Software Foundation, 675 Mass Ave,
  21. Cambridge, MA 02139, USA.
  22.  
  23. \**********************************************************************/
  24.  
  25. #include "timing.h"
  26.  
  27. #define CorrectTime 3
  28. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  29. #define theWindowWidth (boundsRect.right-boundsRect.left)
  30. #define NUM_ITERATIONS    25
  31.  
  32. pascal short QuadrantWipe2Reversed(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect);
  33.  
  34. /* 4 regions, splitting the screen into 4 quadrants.  Wipe the screen right in
  35.    the top-left quadrant, down in the top-right, left in the bottom-right,
  36.    up in the bottom-left. */
  37.    
  38. pascal short QuadrantWipe2Reversed(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect)
  39. {
  40.     int            x;
  41.     Rect        tldest, trdest, bldest, brdest;
  42.     Rect        tlbounds, trbounds, blbounds, brbounds;
  43.     RgnHandle    tlrgn, trrgn, blrgn, brrgn;
  44.     int            cx,cy;
  45.     int            BoxSize, HBoxSize;
  46.     
  47.     BoxSize=theWindowHeight/(NUM_ITERATIONS*2);
  48.     HBoxSize=theWindowWidth/(NUM_ITERATIONS*2);
  49.     
  50.     cx = boundsRect.left + theWindowWidth / 2;
  51.     cy = boundsRect.top + theWindowHeight / 2;
  52.     
  53.     tlbounds=trbounds=blbounds=brbounds=tldest=trdest=bldest=brdest=boundsRect;
  54.     tlbounds.right=trbounds.left=blbounds.right=brbounds.left=
  55.         tldest.right=trdest.left=bldest.right=brdest.left=cx;
  56.     tlbounds.bottom=trbounds.bottom=blbounds.top=brbounds.top=
  57.         tldest.bottom=trdest.bottom=bldest.top=brdest.top=cy;
  58.     tlrgn=NewRgn();
  59.     trrgn=NewRgn();
  60.     blrgn=NewRgn();
  61.     brrgn=NewRgn();
  62.     RectRgn(tlrgn, &tlbounds);
  63.     RectRgn(trrgn, &trbounds);
  64.     RectRgn(blrgn, &blbounds);
  65.     RectRgn(brrgn, &brbounds);
  66.     trdest.right=trdest.left+HBoxSize;
  67.     brdest.bottom=brdest.top+BoxSize;
  68.     bldest.left=bldest.right-HBoxSize;
  69.     tldest.top=tldest.bottom-BoxSize;
  70.     
  71.     for (x=0; x<NUM_ITERATIONS; x++)
  72.     {
  73.         StartTiming();
  74.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  75.                 &trdest, &trdest, 0, trrgn);
  76.         trdest.left+=HBoxSize;
  77.         trdest.right+=HBoxSize;
  78.         
  79.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  80.                 &brdest, &brdest, 0, brrgn);
  81.         brdest.top+=BoxSize;
  82.         brdest.bottom+=BoxSize;
  83.         
  84.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  85.                 &bldest, &bldest, 0, blrgn);
  86.         bldest.left-=HBoxSize;
  87.         bldest.right-=HBoxSize;
  88.         
  89.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  90.                 &tldest, &tldest, 0, tlrgn);
  91.         tldest.top-=BoxSize;
  92.         tldest.bottom-=BoxSize;
  93.         
  94.         TimeCorrection(CorrectTime);
  95.     }
  96.     
  97.     CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  98.         &boundsRect, &boundsRect, 0, 0L);
  99.     
  100.     DisposeRgn(tlrgn);
  101.     DisposeRgn(trrgn);
  102.     DisposeRgn(blrgn);
  103.     DisposeRgn(brrgn);
  104.     
  105.     return 0;
  106. }
  107.